/*
 * @Description: 自定义图片
 * @Author: iamsmiling
 * @Date: 2021-05-24 08:24:12
 * @LastEditTime: 2021-05-24 08:33:17
 */
import 'package:cached_network_image/cached_network_image.dart';
import 'package:credit_business_circle/R/R.dart';
import 'package:flutter/material.dart';

class ChimeraImage extends StatelessWidget {
  final String src;
  final BorderRadius borderRadius;
  final double? width;
  final double? height;
  final BoxFit? fit;
  const ChimeraImage(
      {Key? key,
      required this.src,
      this.borderRadius = BorderRadius.zero,
      this.width,
      this.height,
      this.fit})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ClipRRect(
      borderRadius: borderRadius,
      child: CachedNetworkImage(
          imageUrl: src,
          width: width,
          height: height,
          fit: fit,
          progressIndicatorBuilder: (context, url, downloadProgress) =>
              CircularProgressIndicator(value: downloadProgress.progress),
          errorWidget: (context, url, error) =>
              Image.asset(R.image.imageError)),
    );
  }
}
